package com.example.a14110100409.yuejiandemo.model;

import com.example.a14110100409.yuejiandemo.javabean.Club;
import com.example.a14110100409.yuejiandemo.javabean.Train;
import com.example.a14110100409.yuejiandemo.javabean.TrainInfo;
import com.example.a14110100409.yuejiandemo.service.ActImpls;
import com.example.a14110100409.yuejiandemo.service.ClubService;
import com.example.a14110100409.yuejiandemo.service.TrainService;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

/**
 * Created by owner on 2017/9/26.
 */

public class TrainModel {
    private Retrofit retrofit;
    public TrainModel(){
        retrofit = new Retrofit.Builder()
                .addConverterFactory(GsonConverterFactory.create())
                .baseUrl("http://172.24.10.175/workout/api.php/")
                .build();
    }
    public retrofit2.Call<List<Train>> gettrainlist(){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getTrainList();
    }

    public retrofit2.Call<List<TrainInfo>> gettrainlists(){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.gettrainList();
    }

    public Call<TrainInfo> gettraininfo(String id){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getTraininfo("lgj98rfkiqvenhrk2o7oe2po81","train",id);
    }
    public Call<List<TrainInfo>> gettraintype(String Degree){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.getallTrain("lgj98rfkiqvenhrk2o7oe2po81","train",Degree);
    }
    public Call<Integer> signTrain(String participantname,String train_id,String participanttel,String adultnum,String paytype,
                                   String pay,String paynotice,int userid){
        TrainService trainService = retrofit.create(TrainService.class);
        return trainService.signTrain("signtrain",participantname,train_id,participanttel,adultnum,paytype,pay,paynotice,userid,"lgj98rfkiqvenhrk2o7oe2po81");
    }

    public Call<Integer> signAct(String participantname,String act_id,String participanttel,String adultnum,String studentnum,String paytype,
                                   String pay,String paynotice,int userid){
        ActImpls actImpls = retrofit.create(ActImpls.class);
        return actImpls.signAct("signactivity",participantname,act_id,participanttel,adultnum,studentnum,paytype,pay,paynotice,"保险详细内容",userid,"lgj98rfkiqvenhrk2o7oe2po81");
    }
}
